package com.wss.day10;

import java.util.function.Function;

/**
 * @author wangshaoshuai
 * @desc TODO
 * @date 2025/5/7
 */
public class FunctionDemo {
    public static void main(String[] args) {
        String str = "张三,20";


        Function<String, String> extractAge = s -> s.split(",")[1];


        Function<String, Integer> stringToInt = Integer::parseInt;


        Function<Integer, Integer> addHundred = num -> num + 100;


        Function<String, Integer> finalFunction = extractAge.andThen(stringToInt).andThen(addHundred);


        int result = finalFunction.apply(str);
        System.out.println("最终结果: " + result);
    }
}

